package util.ai;

import java.util.Arrays;

public class DFS1 {
    static int n = 7;
    static int[] a = new int[n];
    static int[] book = new int[n];

    static void dfs(int k) {
        if (k >= n) {
            System.out.println(Arrays.toString(a));
            return;
        }
        for (int i = 0; i < n; i++) {
            if (book[i] == 1) continue;
            a[k] = i;
            book[i] = 1;
            dfs(k + 1);
            book[i] = 0;
        }

    }

    public static void main(String[] args) {
        dfs(0);
    }
}
